package com.eliza.music.model.tmp

import android.util.Log
import androidx.compose.foundation.layout.Column
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Star
import androidx.compose.material3.Text
import androidx.compose.runtime.collectAsState
import androidx.hilt.navigation.compose.hiltViewModel
import com.eliza.library.ui.inter.AIBaseRoute
import com.eliza.music.model.entity.BasicInfo
import com.eliza.music.model.entity.Category
import com.eliza.music.model.entity.UserInfo
import com.eliza.music.model.entity.random
import com.eliza.music.model.vm.PlayingMusicVm
import com.eliza.music.view.music.mine.BasicTitle
import com.eliza.music.view.music.mine.ChooseDirFile
import com.eliza.music.view.music.mine.UserChooseFile
import com.eliza.music.view.music.mine.UserMusicPage


val TagsList = listOf(
    "推荐歌单", "排行榜", "相似推荐", "Top",
    "国创动画", "吃喝玩乐 ", "贪财好瑟",
    "大萌新", "小萌新"
)

fun <T : BasicInfo> DataCategory(pp: List<T>) = Category<T>(
    TagsList.random(), random.nextInt(3), pp,
)

val ListDataCategory = listOf(
    DataCategory(PlaylistListBig.subList(0, PlaylistListBig.size / 4)),
    DataCategory(PlaylistListBig.subList(PlaylistListBig.size / 4, PlaylistListBig.size / 2)),
    DataCategory(PlaylistListBig.subList(PlaylistListBig.size / 2, PlaylistListBig.size / 4 * 3)),
    DataCategory(PlaylistListBig.subList(PlaylistListBig.size / 4 * 3, PlaylistListBig.size)),
)

val UserInfox = UserInfo(
    name = "小萌新在世",
    avatar = ResBackground.random(),
    backgroundImg = "as",
    descriptor = "吃喝玩乐，贪财好瑟",
    tags = listOf("柳风乐迷", "爱听日语歌", "影视原声控", "热爱纯音乐")
)
val AIBaseRoutes: List<AIBaseRoute> = listOf(
    AIBaseRoute("音乐", Icons.Rounded.Star) {
        UserMusicPage(PlaylistList)
    },
    AIBaseRoute("Choose", Icons.Rounded.Star) {
        val playingMusicVm: PlayingMusicVm = hiltViewModel()
        Column {
            UserChooseFile()
            val chooseDirFile = ChooseDirFile(playingMusicVm)
            if (chooseDirFile.isNotEmpty()) {
                for (song in TempSongLists) {
                    song.uri = chooseDirFile.random().uri.toString()
                }
            }
            val value = playingMusicVm.songs.collectAsState().value
            Log.d("PPList", "${value}: ")
            value.forEach {
                Text(text = it.toString())
            }
        }
    },
    AIBaseRoute("播客", Icons.Rounded.Star) {
        Text(text = "播客")
    },
    AIBaseRoute("动态", Icons.Rounded.Star) {
        Text(text = "动态")
    },
)


val BasicTitles = listOf<BasicTitle>(
    BasicTitle(1, "歌单"),
    BasicTitle(1, "SunoAl"),
    BasicTitle(1, "助眠"),
    BasicTitle(1, "欧美"),
    BasicTitle(1, "热门"),
    BasicTitle(1, "咖啡馆"),
    BasicTitle(1, "歌手"),
    BasicTitle(1, "日语"),
)